//
//  GPAccountViewController.m
//  大股票
//
//  Created by mac on 2019/9/5.
//  Copyright © 2019 apple. All rights reserved.
//

#import "GPAccountViewController.h"
#import "GPAccountListViewController.h"
#import "GPTopUpViewController.h"
#import "GPWithdrawalViewController.h"
#import "DGPUtil.h"
#import "HHYHeader.h"

@interface GPAccountViewController ()
@property (weak, nonatomic) IBOutlet UILabel *balanceLab;

@end

@implementation GPAccountViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"账单" style:UIBarButtonItemStylePlain target:self action:@selector(rightAction)];
    self.navigationItem.rightBarButtonItem.tintColor = [UIColor whiteColor];
    
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    UIBarButtonItem *backbutton = [[UIBarButtonItem alloc]init];
    backbutton.title = @"";
    self.navigationItem.backBarButtonItem =backbutton;
    self.navigationController.navigationBar.barTintColor = rgba(255, 64, 0, 1);
    //去掉透明后导航栏下边的黑边
    [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
    UIColor * color =[UIColor whiteColor];
    NSDictionary * dict=[NSDictionary dictionaryWithObject:color forKey:NSForegroundColorAttributeName];
    self.navigationController.navigationBar.titleTextAttributes =dict;
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.balanceLab.text = [NSString stringWithFormat:@"%.2f",[DGPUtil money]];
}

-(void)rightAction{
    GPAccountListViewController *alVC= [[GPAccountListViewController alloc] init];
    alVC.navTitle = @"账单";
    [self.navigationController pushViewController:alVC animated:YES];
}

- (IBAction)topUpAction:(id)sender {
    GPTopUpViewController *topVC = [[GPTopUpViewController alloc] init];
    topVC.navTitle = @"确认充值";
    [self.navigationController pushViewController:topVC animated:YES];
}

- (IBAction)withdrawalAction:(id)sender {
    if (![DGPUtil getZhiFuPwd]) {
        [MBProgressHUD showInformation:@"请先设置支付密码~" toView:self.view andAfterDelay:HUD_TIME];
        [self dismissLoadingAnimatedToView];
    }else{
    GPWithdrawalViewController *wvc = [[GPWithdrawalViewController alloc] init];
    wvc.navTitle = @"提现";
    [self.navigationController pushViewController:wvc animated:YES];
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
